
#ifndef _TTG_EXTRAS_NODES_
#define _TTG_EXTRAS_NODES_
#include "Common/Definitions.h"

#include <list>
#include <string.h>
#include "Common/Strings.h"

namespace ttg
{
	namespace extras
	{
		class TTGXMLTree;
	}
}

namespace ttg_internal
{
	class AttributeNode
	{
		private:
			char *name;
			char *value;
		public:
			AttributeNode(const char *name, const char *value);
			inline const char *getName() const;
			const char *getValue() const;
			~AttributeNode();
	};

	struct SectionNode
	{
		private:
			SectionNode *parent;
			char *name;
			std::list <AttributeNode *> attrnodes;
			std::list <SectionNode *> sectionnodes;
			std::list <AttributeNode *>::iterator attrit;
			std::list <SectionNode *>::iterator sectionit;
		public:
			SectionNode(const char *name, SectionNode *parent);
			const char *getName() const;
			void addAttr(AttributeNode *attrnode);
			void addSection(SectionNode *sectionnode);
			void resetIterators();
			const AttributeNode *getAttribute(const char *name);
			SectionNode *getSection(const char *name);
			std::list<AttributeNode *> &getAttributes();
			std::list<SectionNode *> &getSections();
			const AttributeNode *getNextAttribute();
			SectionNode *getNextSection();
			SectionNode *getParent();
			~SectionNode();
		friend class ttg::extras::TTGXMLTree;
	};
}

#endif
